home *** CD-ROM | disk | FTP | other *** search
- /* selection library.h -- Routines to manipulate Selection objects.
-
- CHANGE LOG
-
- Date Person Action
- ---- ------ ------
-
- 911031 DGO • Created module.
-
- */
-
- /* Copyright ©1991 Apple Computer, Inc. All rights reserved. */
-
- #ifndef selectionLibraryIncludes
- #define selectionLibraryIncludes
-
- #ifndef layoutTypesIncludes
- #include "layout types.h"
- #endif
-
- #ifndef graphicsTypesIncludes
- #include "graphics types.h"
- #endif
-
- /* Constants and Enumerations */
-
- #define selectionExtremeEdge -1
-
- enum {
- emptySelection,
- simpleCaret,
- simpleRange,
- discontiguousRange
- };
- typedef unsigned short SelectionType;
-
- enum {
- notInSelection,
- partlyInSelection,
- fullyInSelection,
- equalToSelection
- };
- typedef unsigned short SelectionMatch;
-
- /* Types and Structures */
-
- typedef long SelectionOffset;
-
- typedef struct {
- SelectionOffset minOffset; /* earliest char */
- SelectionOffset maxOffset; /* latest char */
- } SelectionOffsetRange;
-
- typedef struct {
- long rangeCount;
- SelectionOffsetRange ranges[];
- } SelectionRanges;
-
- typedef struct {
- SelectionOffset offset;
- short leadingEdge;
- } CaretPiece;
-
- typedef struct {
- SelectionType type;
- union {
- CaretPiece caret;
- SelectionRanges range;
- } data;
- } Selection, *SelectionPtr, **SelectionHandle;
-
- /* Routines */
-
- SelectionHandle NewEmptySelection(void);
- SelectionHandle NewCaretSelection(SelectionOffset offset, long leadingEdge);
- SelectionHandle NewRangeSelection(SelectionOffsetRange *range);
-
- SelectionHandle NewFullSelection(void);
- SelectionHandle NewStartSelection(SelectionOffset toOffset);
- SelectionHandle NewEndSelection(SelectionOffset fromOffset);
-
- void SetEmptySelection(SelectionHandle selection);
- void SetCaretSelection(SelectionHandle selection, SelectionOffset offset, long leadingEdge);
- void SetRangeSelection(SelectionHandle selection, SelectionOffsetRange *range);
-
- void SetFullSelection(SelectionHandle selection);
- void SetStartSelection(SelectionHandle selection, SelectionOffset toOffset);
- void SetEndSelection(SelectionHandle selection, SelectionOffset fromOffset);
-
- void DisposeSelection(SelectionHandle selection);
-
- SelectionType GetSelectionType(SelectionHandle selection);
-
- SelectionOffset GetCaretSelection(SelectionHandle selection, boolean *leadingEdge);
- long GetRangeSelection(SelectionHandle selection, SelectionRanges *selectionRanges);
-
- SelectionMatch RangeInSelection(SelectionHandle selection, SelectionOffsetRange *range);
-
- void InvertSelection(SelectionHandle dest);
- void ShiftSelection(SelectionHandle dest, SelectionOffset delta);
-
- void UnionSelection(SelectionHandle dest, SelectionHandle source);
- void SectSelection(SelectionHandle dest, SelectionHandle source);
- void XorSelection(SelectionHandle dest, SelectionHandle source);
- void DiffSelection(SelectionHandle dest, SelectionHandle source);
-
- gxShape GetLayoutSelection(
- gxShape layout,
- SelectionHandle selection,
- SelectionOffset lineStart,
- gxHighlightType highlightType,
- gxCaretType caretType);
-
- SelectionHandle NewDiscontiguousSelection(SelectionRanges *ranges);
-
- #endif
-